/*
 * defs.h
 */
#ifndef _DEFS_H_
#define _DEFS_H_

#define COUNTOF(x) (sizeof(x) / sizeof((x)[0]))

#include <allegro.h>

namespace gui
  {

    struct Size 
      {
        int width, height;
      };

    struct Point 
      {
        int x, y;
      };

    struct Color
      {
        int r, g, b;

        Color() {};

        Color(int color) { *this = color; }

        Color(int r, int g, int b)
          {
            this->r = r;
            this->g = g;
            this->b = b;
          }

        operator int() { return makecol(r,g,b); }

        Color& operator=(int color) 
          {
            r = (color & 0xff0000) >> 16;
            g = (color & 0xff00) >> 8;
            b = color & 0xff;
            return *this;
          }        
      };
  }

#endif
